package com.example.module_house.model
// 外层数据类（区域分组）
//使用groupBy将原始数据按区域分组
data class RegionGroup(
    val regionId: Int,  // 区域名称，如"1栋"
    val buildings: List<HouseEntity>  // 该区域下的所有房源
)
data class HouseEntity(
    val area: Int,
    val enterpriseId: Int,
    val enterpriseName: String,
    val id: Int,
    val regionId: Int,
    val regionName: String,
    val rentDate: Any,
    val rented: Boolean
)
object DataConverter {
    fun convertToRegionGroups(originalList: List<HouseEntity>): List<RegionGroup> {
        // 按区域名称分组
        val grouped = originalList.groupBy { it.regionId }

        // 转换为RegionGroup列表
        return grouped.map { (regionId, buildings) ->
            RegionGroup(regionId, buildings)
        }
    }
}